A Primer in Bar Codes Introduction People unfamiliar with bar codes attribute great powers to these little lines. However, it must be remembered that they are simply a machine readable representation of human readable characters. That is, Optical Character Recognition at the highest accuracy. The best analogy regarding bar codes are that they are like the license plate on your car. Your car does have a VIN or vehicle identification number. However, it would be very difficult to display that number on your license plate. Therefore, you affix a license plate on your car to identify it easily. When you get pulled over for running a stop sign, the officer then asks his/her dispatcher to find the vehicle information using this license plate. The same holds for bar codes. In the most familiar setting, your neighborhood grocery store, when your cashier scans your jar of pickles, the bar code number tells the computer the manufacturer and the manufacturer's product number. The computer will then look up the product description for printing on the receipt and the associated price. Typically, the computer will also decrement the inventory amount and record other data the store desires. The point is, the bar code just represents a number. Many people falsely assume the bar code number holds the price and product description. Why Use Bar Codes? It has been reported that manually keying information from a touchpad or keyboard results in an error rate of 1 out of 300 characters entered. Plus, keying the information takes some time and is often after the fact. In other words, at the end of the week, the accounting department might key in all of the shipping receipts for that week to record the change in inventory. With bar codes, the error rate can be less than 1 error out of 1 million characters. In addition, scanning the information into the computer can be done in a small fraction of the time it takes to key it in. Finally, the data is captured in real time. When an item is shipped, its bar code tag is scanned and the reduction in inventory is recorded. Bar Code Terms SYMBOLOGY: Just as there are different computer languages, there are several different codes or symbologies used by bar codes. Later we will discuss a few of these symbologies and how they differ. START/STOP CODES The bar code scanners need to know when to start and when to stop reading the lines and spaces. Therefore, most symbologies have start and stop characters. In the most common symbology, Code 39, the start and stop codes are the * asterisks. WHITE SPACE One of the more frequent problems with bar code labels that people print themselves is that they try and jam as much as possible in a small area. The problem with that is the scanners need a "quiet zone" or white space before the bar code and after it. Without this white space, the scanner won't read. This is probably the most common reason people have trouble with the wands (commonly called "light pens"). Unfortunately, this problem is self perpetuating. The person tries to scan a bar code with the wand and cannot get a read. They then very carefully place the tip of the wand right next to the first character of the bar code and scan to the end. In their care, they fail to read the white space and the scan fails. Then, they hand the scanner to the "expert" next to them who carelessly swipes the wand over the code and "beep" the scanner registers a read. If you are having problems with the wand, "lighten up" as my teenager would say. Start and end your scan in the white space and you'll be scanning like mad soon. CHECK DIGIT OR CHECK CHARACTER. A check digit is a character or characters, typically placed at the end of the bar code symbol, that has a mathematical relationship to the other characters in the bar code. It is used by the decoder to verify that all of the bar code characters have been decoded correctly. As an illustration, in Code 39 you would calculate the check digit as follows: Sum the character values and divide by 43 (the total number of data characters allowed in this symbology). The remainder is the check digit or character. Mathematically, the already low error rate would be reduced by a factor of 43. In order for a check digit to fail in its error trapping, the bar code must contain two or more offsetting errors to generate the same check digit, an extremely unlikely event. It must be stressed however, that for data where accuracy is critical, check digits are very important and should be included in any database design. A Brief Discussion on the Different Types of Bar Codes UPC: UNIVERSAL PRODUCT CODE. There are different subsets of our common UPC bar code symbology. However the most common is UPC-A, a 10 digit code with the first five digits representing the manufacturer of the item and the next five digits represent the unique product identifier code. Each digit is represented by two bars and two spaces. In addition, there is a leading "system number" which identifies the type of product the symbol is identifying. Finally, there is a check digit that verifies the previous 11 digits of data. Therefore, UPC-A is a 12 digit bar code. Please read the following section, Problems With Bar Codes for a discussion of common problems related to the system number and check digit. The next most common subset of UPC is UPC-E. This is often confused with EAN. UPC-E is simply a six-digit variation of UPC-A and is used for common retail items and is frequently used to label small retail packages. UPC-D is another symbology and is seldom used. EAN: EUROPEAN ARTICLE NUMBERING, available in two versions: EAN-13 and EAN-8. EAN-13 uses basically the same symbology as UPC-A except it adds a country code to the symbology resulting in a 13 digit number. EAN-8 has two digit country codes, five digit data codes identifying the product and manufacturer, and a one digit check code. CODE 39 was the first symbology developed allowing letters (alpha) as well as numbers (numeric) and is thus an alphanumeric symbology. We sometimes hear it called: "Code 3 or 9" or "3 of 9". Each Code 39 character has five bars and four spaces (9 elements) where 3 of the 9 elements are wide. Therefore, you can count the number of wide bars and wide spaces and divide by 3 to determine the total number of characters in a Code 39 bar code. Every Code 39 symbol has a start/stop character of an asterisk: *. Although Code 39 can only support 43 data characters, you can typically switch a decoder on to read the full 128 ASCII set of characters by using certain "shift" symbols. Typically, Code 39 is not used with a check character and is the symbology of choice for many governmental and industrial applications. The reason for this is that it is simple to translate data into its bar code equivalent using Code 39. All one would need to do is to take a "word", add an asterisks to the beginning and end, make sure there are no spaces, and then convert the word to bar code. See the discussion below for specifics using Windows. We recommend using check digits when printing Code 39 with a dot matrix printer. INTERLEAVED 2 OF 5. High density, numeric symbology. Typically used where there is limited space and need only numbers in the bar code. Each bar code character encodes two numbers, one in the spaces and one in the bars. There are five bars and five spaces with two of the five in each being wide. Since each bar code character represents two numbers, all Interleaved 2 of 5 bar codes have an even number of digits (numbers). The start code is two narrow bars with two narrow spaces. The stop code is one wide bar, one narrow space, and one narrow bar. It should be noted that because of the relatively crude start and stop codes, partial scans can result in a valid but incomplete decode. Therefore, this symbology is best used with fixed length applications where the decoding equipment is programmed to accept scans with only the correct number of digits. (For example, in typical .dbf database applications where shorter numbers are padded, you would also pad the bar code number to the fixed length). Other symbologies we will not discuss are: Codabar (used in blood banks, air express), Code 128 (shipping), Code 93 and many others. There are newer "two-dimensional" bar codes that have several rows of codes stacked on top of each other. Each row is dependent on the others and each row is scanned until the entire code is decoded. Code 49 and PDF-417 are the two most common. As a rough example, PDF-417 can contain over 20 times the data in the same space as Code 39. STANDARDS IN BAR CODE. Probably the most misunderstood area of bar codes is in the codes themselves. People generally assume that if you can see dark and white spaces on a page, the bar code is OK. The following will be a brief introduction into some of the complexities of bar codes. As a preface however, I must say that when planning a bar code system, plan to buy or produce the very best bar code labels you can. This will eliminate a great number of headaches and problems down the road. Some of the things to consider when printing your own bar codes are: OPTICAL QUALITIES of the ink verses the paper. Remember, the bar code reader is reading the dark and the white spaces and the contrasts between them. The ink must have a certain light absorption and the paper a certain amount of reflectivity. If you do not think this important, take a blue highlighter and mark up a piece of white paper with it. Then, run it through your copier. You will notice that even though you can read the blue markings, the copier never sees them. The same holds true for bar code readers. We have seen inks that reflect the bar code light just as well as the paper and even though the bar code looks good, it will not scan. PRINTING QUALITY is also critical. Areas of undesired ink called spots or areas of missing ink called voids can destroy the ability of the bar code reader to accurately read the bar code. The width of the bars and spaces is also critical. For example, if you use a dot matrix printer or ink jet, you are putting ink in the paper. If you uses a softer paper, newer ribbon, newer ink cartridge, etc., you will get more spreading of the ink on the paper with resulting wider bars and narrower spaces. Therefore, your chance of poor read rates doubles. With laser printers, you use a thermal transfer process where the ink is applied on the paper or other media and the print consistency is much higher. Unfortunately, the bar code is more fragile since parts of the toner can easily be scraped of. The bottom line here is, even if the bar code looks good to you, the scanner may still not be able to read it. ORGANIZED STANDARDS. Many organizations have published standards for bar codes they or their members use. Some who have standards are: the US Post Office; The Department of Defense; the Uniform Code Council (UPC) in Dayton, Ohio; the European Article Numbering Association in Brussels, Belgium; the American National Standards Institute (ANSI) in New York, the Automotive Industry Action Group in Southfield, Mich.; the Automatic Identification Manufacturers (AIM); and many others. In summary, the most important component of a good bar code system is the bar code itself. Unfortunately, this is the last and least often looked at issue. BAR CODE HARDWARE. There are two basic hardware components in any bar code system: the bar code reader and the bar code decoder. Sometimes, these are included in the same instrument. Often, the reader plugs into the decoder that then transmits the decoded symbol into a processor. Let's start with the readers. For a discussion on some of the problems with readers and decoders, read: Problems with Bar Codes below. Bar Code Readers Wands. The most common and least expensive reader is the bar code wand or "light pen". Here are the pros and cons. Pros: small inexpensive rugged. Cons: difficult to use the poorest read rate of all readers (some people have a long learning cycle to learn how to use the wand) contact and "scrape" scanner--tends to destroy non-laminated bar code labels particularly thermal transfer (laser printer) labels slow to use typically reads only one of three densities (must have three different wands to read all types of bar codes). Bar code label should be clean, dry, and relatively flat. Rules out most soda cans for example. CCD (Charged Coupled Device) Pros: quick can read somewhat rough and cylindrical surfaces less expensive than laser very easy to use even though contact scanner, does not wear the bar code labels since there is no "scraping" of the label Cons: cannot read bar codes wider than the CCD lens more expensive than wand contact device, must touch CCD to bar code to read rather large and bulky LASER SCANNERS PROS: Very fast (most scan the label around 40 times per second) Very accurate (many will double check the bar code by only passing the scans that have been verified with another scan with the same result. Remember though, they are scanning around 40 times per second) Can read at close or long ranges Very easy to use CONS: Somewhat expensive Somewhat fragile Susceptible to sunlight or other bright lights Discussion: From my experience with users, I have come to the following conclusions. Like any tool, every user has their own preferences and styles and so there are many exceptions to these guidelines. Therefore, if you are successfully using a wand to scan nuclear waste in drums and take exception to my suggestion that you use a long range laser scanner, I apologize in advance. Wands: I recommend wands for applications where cost is a consideration, where the primary items the users are scanning are flat such as documents, and where speed is not a consideration. Document tracking is the most common application that comes to mind. CCD: With the new laser CCD type scanners, I see no reason to use the old "charge-coupled device" scanners. The new laser CCDs can be used as a contact scanner or short distance (a few inches) scanner and can read rough and flat surfaces. They are extremely fast, relatively inexpensive, and very easy to use. These are my main recommendation for users who need fast, accurate scans. LASER: Hand held laser scanners are used in warehouse and industrial applications. They can easily be used without leaving the fork lift or other vehicle. Fixed Laser Scanners, such as those you see in the grocery store, are great for portable items that you can move in front of the scanning beams. DECODERS. First of all, how do you know when the scanner has read and the decoder has decoded a bar code? In almost all cases, the reader or scanner will beep (or talk) to you to let you know. After the reader reads the bar code symbol, it sends its data to the decoder. There are three typical decoders: those in the bar code reader itself, those in a device between the reader and the processor (computer), and those in the processor itself. Some hand-held laser scanners have decoders built into them. They then plug directly into a storage or computing device. Let's illustrate with a typical use. A store has a hand-held laser scanner that is plugged into the serial port on the computer. The reader reads and the decoder decodes the scanned bar code and sends the ASCII (human readable) data into the serial port on the PC. Now what? Now it is up to you to use software to collect and tabulate the data. The most common process is to use a TSR (memory resident program that you load when you start your computer) to "watch" the serial port. When data comes into the serial port, the TSR will then redirect it to the keyboard buffer of your computer. The bottom line is that you can scan a bar code label at your cash register and the data travels from your reader/decoder to the serial port where your TSR will send it to the keyboard buffer. Your program thinks the number was typed in at the keyboard and processes the data just as if you had typed it. However, all of this takes less than a second to process. By far the most common bar code decoder is called a WEDGE. This is a small device that fits between your computer keyboard and the computer terminal; e.g., it wedges itself in between the two (isn't it nice when a computer device has a real name instead of initials like: RAM, ROM, EPROM, DOS, etc.?). You use your keyboard as you normally do. However, after the wedge decodes a bar code, it sends the data to the computer terminal just as if you had typed it. For example, if you are using bar codes to check out a book, the library computer system might ask for the book's identification number represented by a bar code. You could either take 20 seconds to type the number in, or take 1 second and use your bar code reader to scan the number in. Either way, the number goes through your keyboard port on your computer to your program. The third way that you can decode your bar codes is at the processor level. The most common methodology is to incorporate a hand-held processor that decodes the bar codes, processes the data, and stores it for later transmission to the computer or network. These hand-held devices can be quite sophisticated and provide some error checking to the data received. For example, in a bar code asset tracking system, you might have the operator use a 3 digit number, the location be a five digit number, and the asset be a 9 digit number. When you scan a number, the decoder/processor will know by the number length what type of data it has received and process it accordingly. Likewise, when the decoder/processor determines an incorrect number scanned, it can provide an error message to the operator. The same functionality that the hand-helds have is possible at the computer level. That is, the scanner reads the bar code, send the machine readable data to the serial port, a TSR intercepts the raw bar code, translates it into human readable or ASCII and then moves the data where you instruct it to go, typically the keyboard buffer. TYING IT ALL TOGETHER By far, the most common source of problems that people take when they approach a bar code project is that they do not come with a systems solution. Like a computer network, it is imperative that some advance planning and goal setting be done before you make your purchases to insure all of the components work well together. With bar code systems, I frequently suggest the "phased approach" where the user starts out small with a few readers and users to locate potential "bugs" in the system. When planning the system, formulate your goals. It helps to flow chart your plans specifying how and where you want bar codes to help. Then, call in an expert to help. She/he will probably find areas where you should modify your plans and can make recommendations regarding hardware and software to help you meet your needs. It is interesting that studies have shown even the most expensive bar code systems pay for themselves in a matter of months, not years. COMMON PROBLEMS WITH BAR CODES AND THEIR SOLUTIONS Scanning Problems Wands. If you are having problems reading bar codes with a wand, try the following: hold the wand like a pencil; i.e., at a slight angle to the label start and end in the white space at either side of the label; don't start at edge of the first dark spot. Remember, bar code readers read the white and black. Scan with a smooth and steady motion, don't move slowly. Too fast is better than too slow. Use the correct wand for the labels you are scanning. Typically, there are three different wand tips for reading three different densities of bar codes. Scan a label of known quality to make sure the problem is not with your labels. Decoders. One of the most common complaints I hear from people is that they have bought a scanner that they typically use to read say Code 39 and they have decided to use it in their employee store (or vice versa) and it will not read UPC. They remember it is supposed to read UPC so what is the problem? Quite likely the problem is that the decoder has been programmed to not read UPC. Most decoders have ROM (read only memory) programs that tell them how to identify and decode different symbologies. When the reader sends a bar code signal to the decoder, the decoder must search the libraries on the ROM to identify the correct symbology and then translate or decode the symbol. Often, your installer will turn off unused symbologies to speed up the decode process. With almost all readers/decoders there is a book with pages of programming bar codes. If your reader cannot read a symbology, then you will need get the owner's manual and scan the programming code to turn the symbology on. Here are some other common decoder options that you will need to use the programming bar codes to change: Beep on or off Add a prefix or suffix to the scanned code (most common suffix is adding a carriage return and/or line feed to the end of the scan) UPC A and E Preambles: I have gotten several calls from retailers who have a database established with all of their bar code UPC numbers in them. Their scanner dies and they call XYZ Computer Discount Supply store for a new bar code reader. They install the reader and find that the program will not accept the data scanned in. The decoder beeps and sends the number to the program, but the program cannot find the corresponding item in the database. The problem is the "dead" decoder either did or did not send the system number and the new one is doing the opposite. Most commonly, the old unit did not send the leading 0 and the new one does. You will need to scan the appropriate programming code to set up your new scanner to not pass the leading 0 or country supplementals. These programming codes are important. For example, in the Symbol Technologies LalserTouch® Product Reference Guide, there are close to 50 pages of programming bar codes out of the 83 page manual.